/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fwannotations.framework;

import fwannotations.framework.annotations.controller.Control;
import fwannotations.framework.annotations.MiAnn;
import fwannotations.framework.annotations.MethodoPath;
import control.ControlConfig;
import fwannotations.context.ContextControl;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author HP_Propietario
 */
public class AnnotationsManager {

    private static final Map map = new HashMap();

    public void getAnnotationClass(Object object) {

        Class clazz = object.getClass();
        Annotation[] annotations = clazz.getAnnotations();
        for (int i = 0; i < annotations.length; i++) {
            Annotation annotation = (Annotation) annotations[i];
            System.out.println("" + annotation.annotationType().getName());
            String nameAnnotation=annotation.annotationType().getName();
            if(annotation instanceof Control){
                System.out.println("-->"+annotation.annotationType().getName());
                    Control control=(Control)annotation;
                    ControlConfig config=new ControlConfig();
                    config.setControllerName(control.controllerName());
                    config.setNameView(control.nameView());
                    config.setPath(control.path());
                    System.out.println("-->"+control.controllerName());
                    System.out.println("-->"+control.nameView());
                    System.out.println("-->"+control.path());
                    /*


                    System.out.println("control.uri()..."+control.uri());
                    System.out.println("control.pack()..."+control.pack());
                    ContextControl.getContextControl().addControlsControl(control.uri(),control.pack());
                     *
                     * */
            }
            if(annotation instanceof MiAnn){
                    MiAnn ma=(MiAnn)annotation;
                    System.out.println("-->"+annotation.annotationType().getName());
                    System.out.println("MiAnn-->"+ma.apellidos());
                    System.out.println("MiAnn-->"+ma.nombre());
                    ContextControl.getContextControl().addControlsMiAnn(ma.nombre(), ma.apellidos());

            }
            if(annotation instanceof MethodoPath){
                    MethodoPath ma=(MethodoPath)annotation;
                    System.out.println("-->"+annotation.annotationType().getName());
                    System.out.println("MethodoPath-->"+ma.nombre());
                    System.out.println("MethodoPath-->"+ma.uri());
                    ContextControl.getContextControl().addControlsMiAnn(ma.nombre(), ma.uri());

            }

        }

    }

   
}
